#if 0
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include<memory.h>


typedef enum
  {
    NONE,
    DEFINE,
    START,
    VARIABLES,
    DIGIT,
    STRING,
    LEFTCBRACKET, //[
    RIGHTCBRACKET,//]
    LEFTSBRACKET ,//{
    RIGHTSBRACKET,//}
    INCLUDE ,
    DOT,          //.
    GREAT,        //>
    LESS,         //<
    NUMBER,
    IDENTITY,
    STAR,         //*
    SEMICOLON,    //,
    LEFTPARENTHESIS,      //(
    RIGHTPARENTHESIS,     //)
    LEFTQUOTE,    //'
    SHARP,        //#
    COLON,        //:
    UNDERSCORE,   //_
    SPACE,        //
    ENTERLINE,    //\n
    TAB,          //\t
    PLUS,         // +
    MINUS,        // -
    DIV,          ///
    ASSIGN,        // =
    EQUAL,       // ==  
    QMARK,        //?
    SLASH,        
    VBAR,          //|
    DOLLAR,       //$
    POW,          //^
    AT,           //@
    TILDE,        //~
    AUTO,
    BREAK,
    CASE,
    CHAR,
    CONST,
    CONTINUE,
    DEFAULT,
    DO,
    DOUBLE,
    ELSE,
    ENUM,
    EXTERN,
    FLOAT,
    FOR,
    GOTO,
    IF,
    INLINE,
    INT,
    LONG,
    REGISTER,
    RESTRICT,
    RETURN,
    SHORT,
    SIGNED,
    SIZEOF,
    STATIC,
    STRUCT,
    SWITCH,
    TYPEDEF,
    UNION,
    UNSIGNED,
    VOID,
    VOLATILE,
    WHILE 
  }TreeType;

struct map
{
	char *name;
	TreeType t;
};

struct map xmap[] = {
	{"typedef",TYPEDEF},
	{"include",INCLUDE},
	{"auto",AUTO},
	{"break",BREAK},
	{"case",CASE},
	{"char",CHAR},
	{"const",CONST},
	{"continue",CONTINUE},
	{"default",DEFAULT},
	{"do",DO},
	{"double",DOUBLE},
	{"else",ELSE},
	{"enum",ENUM},
	{"extern",EXTERN},
	{"float",FLOAT},
	{"for",FOR},
	{"goto",GOTO},
	{"if",IF},
	{"inline",INLINE},
	{"int",INT},
	{"long",LONG},
	{"register",REGISTER},
	{"restrict",RESTRICT},
	{"return",RETURN},
	{"short",SHORT},
	{"signed",SIGNED},
	{"sizeof",SIZEOF},
	{"static",STATIC},
	{"struct",STRUCT},
	{"switch",SWITCH},
	{"typedef",TYPEDEF},
	{"union",UNION},
	{"unsigned",UNSIGNED},
	{"void",VOID},
	{"volatile",VOLATILE},
	{"while ",WHILE },
	{"[",    LEFTCBRACKET},
	{"]",    RIGHTCBRACKET},
	{"{",    LEFTSBRACKET },
	{"}",    RIGHTSBRACKET},
	{".",    DOT},
	{">",    GREAT},
	{"<",    LESS},
	{"*",    STAR},
	{",",    SEMICOLON},
	{"(",    LEFTPARENTHESIS},
	{")",    RIGHTPARENTHESIS},
	{"'",    LEFTQUOTE},
	{"#",    SHARP},
	{":",    COLON},
	{"_",    UNDERSCORE},
	{" ",    SPACE},
	{"\n",    ENTERLINE},
	{"\t",    TAB},
	{"+",    PLUS},
	{"-",    MINUS},
	{"",    DIV},
	{"=",    ASSIGN},
	{"==",   EQUAL},  
	{"?",    QMARK},
	{"\\",    SLASH},
	{"|",    VBAR},
	{"$",    DOLLAR},
	{"^",    POW},
	{"@",    AT},
	{"~",    TILDE}
};

int xmapLength = sizeof(xmap)/sizeof(xmap[0]);

typedef struct token
{
  char name[40];
  TreeType t;
}Token;

Token tokens[100000];

int strlen_test(char *p)
{
  int i = 0;
  char *pt = p;

  for(;*pt != '\0';pt++)
    {
      i++;
    }
  return i;
}


Token * makeToken_test(char *p,TreeType t)
{
  char *pt = p;
  int index = 0;
  Token *token = (Token *)malloc(sizeof(Token));
  memset(token,0,sizeof(Token));

  if(strlen_test(p)<40)
    {
      for(;*pt != '\0';pt++)
        {
          token -> name[index++] = *pt; 
        }
      token -> name[index] = '\0'; 
    }
  token -> t = t;
  return token;
}

TreeType Get_Tree_Type_Test(char *p)
{
  int i = 0;
  for(i = 0;i<xmapLength;i++)
    {
      if(strcmp(xmap[i].name,p) == 0) 
        {
          return xmap[i].t;
        }
    }
  return NONE;
}

void push_token()
{

}

#if 0
#define TokenArrayTestMain main
#endif

int TokenArrayTestMain(int argc,char **argv)
{
  Token t[1000];//Token Queue
  char *p = "typedef";

  // Token *pToken = makeToken_test(p,IDENTITY);
  printf("%d\n",Get_Tree_Type_Test(p));
  
  return 0;
}
#endif